package com.qrpcw.careercup;
import java.util.HashMap;
import java.util.Set;

public class HashMapTest {

	public static void main(String[] args) {
		Student student1 = new Student(1,"Carson");
		Student student2 = new Student(2,"Sharon");
		Student[] students = new Student[]{student1,student2};
		HashMapTest test = new HashMapTest(); 
		test.printMap(test.buildMap(students));
	}
	
	public HashMap<Integer, Student> buildMap(Student[] students){
		HashMap<Integer, Student> map = new HashMap<Integer, Student>();
		for (Student s : students){
			map.put(s.getId(),s);
		}
		return map;
	}
	
	public void printMap(HashMap<Integer, Student> map){
		Set<Integer> set = map.keySet();
		for(Integer key:set){
			System.out.println(map.get(key).getId()+" "+ map.get(key).getName());
		}
	}
}
